{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d3bec5fe",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6ec8d7fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>石门县新铺镇黄家峪村卫生室</th>\n",
       "      <th>无等级</th>\n",
       "      <th>黄家峪村,常德市石门县J一三县道</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>石门县新铺镇黄家峪村卫生室</td>\n",
       "      <td>无等级</td>\n",
       "      <td>黄家峪村,常德市石门县J一三县道</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>株洲北雅医院株洲北雅疼痛医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>株洲北雅医院,株洲市石峰区天桥街259号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>石门县新铺镇黄家峪村卫生室</td>\n",
       "      <td>无等级</td>\n",
       "      <td>黄家峪村,常德市石门县J一三县道</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>株洲北雅医院株洲北雅疼痛医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>株洲北雅医院,株洲市石峰区天桥街259号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>浏阳市骨伤科医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>浏阳市骨伤科医院,长沙市浏阳市社港镇新光村新港北路社港中学对面</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    石门县新铺镇黄家峪村卫生室   无等级                 黄家峪村,常德市石门县J一三县道\n",
       "0   石门县新铺镇黄家峪村卫生室   无等级                 黄家峪村,常德市石门县J一三县道\n",
       "1  株洲北雅医院株洲北雅疼痛医院  二级甲等             株洲北雅医院,株洲市石峰区天桥街259号\n",
       "2   石门县新铺镇黄家峪村卫生室   无等级                 黄家峪村,常德市石门县J一三县道\n",
       "3  株洲北雅医院株洲北雅疼痛医院  二级甲等             株洲北雅医院,株洲市石峰区天桥街259号\n",
       "4        浏阳市骨伤科医院  二级甲等  浏阳市骨伤科医院,长沙市浏阳市社港镇新光村新港北路社港中学对面"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('Hospital_data2.csv')\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ef1101ec",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 222338 entries, 0 to 222337\n",
      "Data columns (total 3 columns):\n",
      " #   Column            Non-Null Count   Dtype \n",
      "---  ------            --------------   ----- \n",
      " 0   石门县新铺镇黄家峪村卫生室     222338 non-null  object\n",
      " 1   无等级               222338 non-null  object\n",
      " 2   黄家峪村,常德市石门县J一三县道  222338 non-null  object\n",
      "dtypes: object(3)\n",
      "memory usage: 5.1+ MB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8e2b76aa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 39982 entries, 0 to 222337\n",
      "Data columns (total 3 columns):\n",
      " #   Column            Non-Null Count  Dtype \n",
      "---  ------            --------------  ----- \n",
      " 0   石门县新铺镇黄家峪村卫生室     39982 non-null  object\n",
      " 1   无等级               39982 non-null  object\n",
      " 2   黄家峪村,常德市石门县J一三县道  39982 non-null  object\n",
      "dtypes: object(3)\n",
      "memory usage: 1.2+ MB\n"
     ]
    }
   ],
   "source": [
    "df2 = df.drop_duplicates()\n",
    "df2.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7ceb2b67",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>石门县新铺镇黄家峪村卫生室</th>\n",
       "      <th>无等级</th>\n",
       "      <th>黄家峪村,常德市石门县J一三县道</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>石门县新铺镇黄家峪村卫生室</td>\n",
       "      <td>无等级</td>\n",
       "      <td>黄家峪村,常德市石门县J一三县道</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>株洲北雅医院株洲北雅疼痛医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>株洲北雅医院,株洲市石峰区天桥街259号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>浏阳市骨伤科医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>浏阳市骨伤科医院,长沙市浏阳市社港镇新光村新港北路社港中学对面</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>安化县人民医院</td>\n",
       "      <td>二级甲等</td>\n",
       "      <td>安化县人民医院,湖南省安化县东坪镇迎春路7号</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>株洲市人民医院</td>\n",
       "      <td>三级甲等</td>\n",
       "      <td>株洲市人民医院,湖南省株洲市荷塘区新华西路新屋街300号</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     石门县新铺镇黄家峪村卫生室   无等级                 黄家峪村,常德市石门县J一三县道\n",
       "0    石门县新铺镇黄家峪村卫生室   无等级                 黄家峪村,常德市石门县J一三县道\n",
       "1   株洲北雅医院株洲北雅疼痛医院  二级甲等             株洲北雅医院,株洲市石峰区天桥街259号\n",
       "4         浏阳市骨伤科医院  二级甲等  浏阳市骨伤科医院,长沙市浏阳市社港镇新光村新港北路社港中学对面\n",
       "8          安化县人民医院  二级甲等           安化县人民医院,湖南省安化县东坪镇迎春路7号\n",
       "13         株洲市人民医院  三级甲等     株洲市人民医院,湖南省株洲市荷塘区新华西路新屋街300号"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1851cf23",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(39982, 3)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "6f61dfaa",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2.to_csv('hospital_data.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "554bc43f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
